System Module

The properties of a System object are used to get information about the user's computer.

Properties

AddressBook

Keyscript

NetworkInterfaceCount

CommandLine

MouseDown

PPPStatus

Cursors

MouseX

QuickTime

Keychain

MouseY

SerialPortCount

KeyChainCount

Network

 

Methods

DebugLog

Log

PPPConnect

EnvironmentVariable

PenButtonPushed

PPPDisconnect

Gestalt

PenPressure

SerialPort

GetNetworkInterface

PenType

 

IsFunctionAvailable

Pixel

 


PPP

The point-to-point protocol (PPP) is used to gain a connection to the Internet with a dial-up modem. It is system-wide functionality that you can use to get the modem to dial out to an ISP, and upon successful connection, your TCPSocket or UDPSocket code will be able to communicate with the outside world.

If you call the PPPDisconnect method, it will terminate the computer's connection to the Internet. This means that you will kill other applications' connections as well as REALbasic's, so be sure to ask the user if they want the connection terminated before happily killing all connections to the Internet.

The PPPConnect method behaves slightly differently, depending on how you use it. If you pass True on Macintosh, there will be no intervention. There are no standard dialogs provided for the user to choose which connection to use on Macintosh. If you pass True on Windows and the user is running Windows NT 4 or later, then the standard RAS Manager dialogs will appear and ask the user for connection information. If the user is running Windows 98/ME or you pass False or do not pass a parameter, then the system will attempt the connection using the first phonebook entry it can find.


PPPStatus values

The following table summarizes the values returned by the PPPStatus property. You can determine the status by comparing the PPPStatus property to the class constants.

ValueClass ConstantDescription
0 PPPNoConnection There is no connection present. This means that you haven't called the PPPConnect method or the connection process failed. It could also mean that you have called the PPPDisconnect method and the connection has been disconnected.
1 Not used.
3 PPPConnectionClosing The connection is being closed. This means that you have called the PPPDisconnect method and the disconnection process has begun. It does not mean that the disconnect is complete.
4 PPPConnectionOpening A connection is being attempted. This does not mean that you have a valid internet connection. Calling your TCPSocket or UDPSocket code before retesting for a valid connection may cause an error.
5 PPPConnected You have a valid connection. This means that you can execute your TCPSocket or UDPSocket code because you are fully connected.


LogLevel Class Constants

Use the following class constants when setting the value of the Level parameter in calls to the Log method.

Constant
LogLevelAlert
LogLevelCritical
LogLevelDebug
LogLevelEmergency
LogLevelError
LogLevelInformation
LogLevelNotice
LogLevelSuccess
LogLevelWarning

For example, Log(System.LogLevelError, "my Error message") writes your error message with the LogLevelError constant.


Notes

MouseX and MouseY return coordinates with respect to the top-left corner of the user's monitor. The Window and Control classes contain MouseX and MouseY properties that are referenced to the window (in the case of the Control class, the control's parent window).

The SerialPort and SerialPortCount properties work normally in carbonized applications running in Mac OS X. However, carbon applications running under Mac OS "classic" versions cannot access the serial ports. For those machines, build a separate "classic" version of your application.

The Point-to-Point protocol (PPP) is the protocol used for establishing an internet connection via a dial-up modem. Once a connection is established, you can use objects derived from the TCPSocket and/or UDPSocket classes to manage the connection.

Multiple Interface Support

Multiple network interface support enables you to write applications that can bind to different NIC cards installed on a user's machine. For example, you can use this to write tunneling applications. To see what interfaces are installed on the user's machine, you can use the GetNetworkInterface method and assign the obtained interface object to a NetworkInterface property of the SocketCore class.


Example

The following displays the number of serial ports on the user's machine and their names. On a 'normal' Macintosh, serialport zero is the Modem port and serialport 1 is the Printer port:

EditField1.text= Str(System.serialportcount)
EditField2.text=System.serialport(0).Name
EditField3.text=System.serialport(1).Name

The following returns the version of QuickTime installed on the user's computer:

Dim s as String
Dim b as Boolean
Dim i,resp as Integer
#If TargetMacOS
b=System .gestalt("qtim",resp)
If b then
 s= Hex(resp)
 For i = Len(s) downto 1
  s= Left(s,i)+"."+ Mid(s,i+1)
 Next
  MsgBox "QuickTime version "+s
End if
#Endif

This example checks whether the application is running on Mac OS 8.5 or higher:

// check the system version, since these
//functions are only available
// in MacOS 8.5 and higher
Dim SysVersion as Integer
If System.Gestalt("sysv", sysVersion) and sysVersion >= &h0850 then
// do something cool here
end if

To determine whether the application is running under Mac OS X, use the same code but with a constant of &h1000.


See Also

Application, MouseCursor, SerialPort classes; App, Cursors, NetworkInterface objects.